package study.bbs.cloud.admin.feign.factory;

import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;
import study.bbs.cloud.admin.feign.client.TestFeignClient;
import study.bbs.cloud.admin.feign.fallback.TestFeignClientFallBack;

@Component
public class TestFeignFactory implements FallbackFactory<TestFeignClient> {

    private final TestFeignClientFallBack testFeignClientFallBack;

    public TestFeignFactory(TestFeignClientFallBack testFeignClientFallBack) {
        this.testFeignClientFallBack = testFeignClientFallBack;
    }

    @Override
    public TestFeignClient create(Throwable throwable) {
        System.out.println("异常打印...");
        throwable.printStackTrace();
        return testFeignClientFallBack;
    }
}
